package com.sunlgggg.object;

import com.google.gson.internal.LinkedTreeMap;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;

/**
 * @author sunlggggg
 * @date 2016/12/1
 */
public class StudentInfo {
    private String stuId;
    private String name;
    private String gender;
    private Date bornDate;
    private Double chineseScore;
    private Double mathScore;
    private Double englishScore;


    public StudentInfo() {
    }

    public StudentInfo(LinkedTreeMap info) {
        this.gender = (String) info.get("gender");
        this.name = (String) info.get("name");
        this.stuId = (String) info.get("stuId");
        this.chineseScore = (Double) info.get("chinese");
        this.mathScore = (Double) info.get("math");
        this.englishScore = (Double) info.get("english");
        this.bornDate= new Date(Date.parse((String) info.get("bornDate")));
    }

    public StudentInfo(String stuId, String name,
                       String gender, Date bornDate,
                       Double chineseScore,
                       Double mathScore,
                       Double englishScore) {
        this.stuId = stuId;
        this.name = name;
        this.gender = gender;
        this.bornDate = bornDate;
        this.chineseScore = chineseScore;
        this.mathScore = mathScore;
        this.englishScore = englishScore;
    }

    public String getStuId() {
        return stuId;
    }

    public void setStuId(String stuId) {
        this.stuId = stuId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Date getBornDate() {
        return bornDate;
    }

    public void setBornDate(Date bornDate) {
        this.bornDate = bornDate;
    }

    public Double getChineseScore() {
        return chineseScore;
    }

    public void setChineseScore(Double chineseScore) {
        this.chineseScore = chineseScore;
    }

    public Double getMathScore() {
        return mathScore;
    }

    public void setMathScore(Double mathScore) {
        this.mathScore = mathScore;
    }

    public Double getEnglishScore() {
        return englishScore;
    }

    public void setEnglishScore(Double englishScore) {
        this.englishScore = englishScore;
    }


    public String[] getStrings() {
        String[] strings = new String[7];
        strings[0] = this.stuId;
        strings[1] = this.name;
        strings[2] = this.gender;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy   MM  dd");
        strings[3] = simpleDateFormat.format(this.bornDate);
        strings[4] = this.chineseScore.toString();
        strings[5] = this.mathScore.toString();
        strings[6] = this.englishScore.toString();
        return strings;
    }
    @Override
    public String toString() {
        return "StudentInfo{" +
                "stuId='" + stuId + '\'' +
                ", name='" + name + '\'' +
                ", gender='" + gender + '\'' +
                ", bornDate=" + bornDate +
                ", chineseScore=" + chineseScore +
                ", mathScore=" + mathScore +
                ", englishScore=" + englishScore +
                '}';
    }
}
